package org.mysfit.ctp4j.api.controller.v1;

import org.mysfit.ctp4j.core.service.MarketService;
import org.mysfit.ctp4j.infra.pojo.ApiResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 
 * @author long.gf
 *
 */
@RestController
@RequestMapping("/v1/market")
public class MarketController {
	
	@Autowired
	private MarketService service;
	
	@GetMapping("/subscribe/{investorId}")
	public ApiResponse<String> subscribe(@PathVariable("investorId")String investorId) {
		try {
			service.subscribe(investorId);
			return ApiResponse.ok();
		} catch (Exception e) {
			return ApiResponse.error(e);
		}
	}
}
